names = []
import os
from max_建表SQLBuilder import create_table, drop_table, select_all

local = __file__
print(local)
path = os.path.dirname(local)
from table_list import *

for _table in table_list:
    with open(f"{path}/{_table}.txt", "r", encoding="utf-8") as f:
        lines = f.readlines()
        names = []
        # for line in lines:
        #     names.append(line.rstrip().lower().split(","))

        # for line in names:
        #     print(line)
        outputpath = f"{path}/{_table}"
        if not os.path.exists(outputpath):
            os.makedirs(outputpath)
        output = open(f"{outputpath}/{_table}.ddl.sql", "w", encoding="utf-8")
        print(drop_table(_table, False), file=output)
        print(create_table(_table, lines[1], lines[2], lines[0], exe=False), file=output)
        print(select_all(_table), file=output)
